package com.example.shiro_springboot.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("userController")
public class UserController {

    // @RequiresPermissions("user:del")  说明调用此方法的用户需要有user:del的权限
    @RequiresPermissions("user:del")
    @RequestMapping("userDel")
    @ResponseBody
    public String userDel(){
        System.out.println("用户信息删除单元方法执行");
        return "删除成功";
    }

    @RequiresPermissions("user:update")
    @RequestMapping("userUpdate")
    @ResponseBody
    public String userUpdate(){
        System.out.println("用户信息修改单元方法执行");
        return "修改成功";
    }

    @RequiresPermissions("user:add")
    @RequestMapping("userAdd")
    @ResponseBody
    public String userAdd(){
        System.out.println("用户信息添加单元方法执行");
        return "添加成功";
    }

    @RequiresPermissions("user:query")
    @RequestMapping("userQuery")
    @ResponseBody
    public String userQuery(){
        System.out.println("用户信息查询单元方法执行");
        return "查询成功";
    }
}
